package com.java复习.练习一二四答案.demo5;




public class RightTriangle  extends Triangle {

    private double hypotenuse;

    public RightTriangle(int base ,int height){
        super(base,height);
        hypotenuse = Math.sqrt(base*base +height*height);
        System.out.println("右三角构造方法被调用！");
    }

    @Override
    public String toString() {
        String str1 = super.toString();
        return str1 + "斜边长度为："+ this.hypotenuse;
    }
}
